﻿@using Pay.Token.Utils
@model PagedResult<product_dto>
@{
    var img_url = ViewBag.img_url;
    int userType = ViewBag.UserType;
    if (Model.rows.Count > 0) {
        foreach (var item in Model.rows) {
            <li>
                <a href="@(((item.activity_ex != null && item.activity_ex.is_sold_out == true) || (item.activity_ex != null && item.activity_ex.begin_time > DateTime.Now))
                            ? "javascript:void(0)" : "/DistributionMall/ProductDetail?productId=" + item.id) ">
                    <div class="imgsrc">
                        <img src="@item.main_image_url" alt="" />
                    </div>
                    <p>@item.name</p>
                    @if (item.activity_ex != null && item.activity_ex.is_sold_out == true) {
                        <div class="price"><span class="fn30">￥@(item.price.ToString("f2"))</span> <span class="buybtn sellout">已售罄</span> </div>
                        <i class="selloutbg"></i>
                    } else if (item.activity_ex != null && item.activity_ex.begin_time > DateTime.Now) {
                        <div class="price"><span class="fn30">￥@(item.price.ToString("f2"))</span> <span class="buybtn sellout">即将开始</span> </div>
                    } else {
                        <div class="price"><span class="fn30">￥@(item.price.ToString("f2"))</span> <span class="buybtn">立即购买</span> </div>
                    }
                </a>
            </li>
        }
    }
    <page total_pages="@Model.total_pages" rows="@Model.rows.Count()" total_result="@Model.total_result"></page>
}


